#include<bits/stdc++.h>
using namespace std;

bool check(int x)
{
	if(x <= 1)
		return false;
	int k = sqrt(x);
	for(int i = 2;i <= k;i++)
		if(x%i == 0)
			return false;
	return true;
}

priority_queue<int, vector<int>, greater<int> > pq;

int main()
{
	int x;
	for(int i = 1;i <= 10;i++)
	{
		cin>>x;
		if(check(x))
			pq.push(x);
	}
	while(!pq.empty())
	{
		cout<<pq.top()<<" ";
		pq.pop();
	}
    return 0;
}

